package com.tledu.springboot04.core.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Antg
 * @date 2021/8/26  16:48
 */
@Configuration
public class WebAppConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/login")//不过滤登录页面
                .excludePathPatterns("/css/**", "/fonts/**", "/images/**", "/js/**", "/lib/**");//不过滤静态资源
    }
}
